﻿using System;
using System.Data;
using System.Data.SqlClient;
using System.Collections.Generic;
using System.Text;
using Portal.Environment;
using Portal.Language;
using Portal.Interface;

namespace Portal.CDSP
{
    public class SuggestDetailWP : Portal.Interface.WebPart
    {
        public override string WebPartId
        {
            get
            {
                return "WebSite.SuggestDetailWP";
            }
        }

        public override string Title
        {
            get
            {
                return ResourceBLL.GetText(WebPartId, "Title", "Xem Chi tiết Góp ý");
            }
        }

        public override string Description
        {
            get
            {
                return ResourceBLL.GetText(WebPartId, "Description", "");
            }
        }


        public override string RenderWebPart(LoadParamCls loadParamCls)
        {
            AjaxPro.Utility.RegisterTypeForAjax(typeof(SuggestDetailWP));
            AjaxPro.Utility.RegisterTypeForAjax(typeof(MagSuggestWP));

            string SgID = System.Web.HttpContext.Current.Request["SuggestID"];
            //var fbitem = FSuggestBLL.SelectById(fbid);
            ContactCls FSGCls = new ContactBLL().SelectByID(SgID);

            string ReturnHtml =
                Portal.Environment.WebPartUtilities.AttachJavascript("Portal.CDSP", "feedback.js") +
                "<table>" +
                // Full Name Text
                "   <tr>" +
                "       <td style='width:80px;'>" + ResourceBLL.GetText(WebPartId, "SG_Name", "Tên") + "</td>" +
                "       <td><input class='cssTextBoxDialog' id='txtGuestName' maxlength=\"125\" value=\"" + FSGCls.SuggestBy + "\" /></td>" +
                "   </tr>" +
                // Address Text
                "   <tr>" +
                "       <td>" + ResourceBLL.GetText(WebPartId, "SG_Address", "Địa chỉ") + "</td>" +
                "       <td><input class='cssTextBoxDialog' id='txtAddress' maxlength=\"225\" value=\"" + FSGCls.Address + "\" /></td>" +
                "   </tr>" +
                // Phone Text
                "   <tr>" +
                "       <td>" + ResourceBLL.GetText(WebPartId, "SG_Phone", "Điện thoại") + "</td>" +
                "       <td><input class='cssTextBoxDialog' id='txtPhone' maxlength=\"225\" value=\"" + FSGCls.Phone + "\" /></td>" +
                "   </tr>" +
                // Email Text
                "   <tr>" +
                "       <td>" + ResourceBLL.GetText(WebPartId, "SG_Email", "Email") + "</td>" +
                "       <td><input class='cssTextBoxDialog' id='txtEmail' maxlength=\"225\" value=\"" + FSGCls.Email + "\" /></td>" +
                "   </tr>" +
                // Data Text
                "   <tr>" +
                "       <td>" + ResourceBLL.GetText(WebPartId, "SG_SendDate", "Ngày gửi") + "</td>" +
                "       <td><input readonly class='cssTextBoxDialog' id='txtSendDate' maxlength=\"225\" value=\"" + FSGCls.Time + "\" /></td>" +
                "   </tr>" +
                // Subject
                   "   <tr>" +
                "       <td>" + ResourceBLL.GetText(WebPartId, "SG_Subject", "Tiêu đề") + "</td>" +
                "       <td><textarea id='txtSubject' class='cssTextBoxDialog' maxlength=\"225\">" + FSGCls.Subject + "</textarea></td>" +
                "   </tr>" +

                // Body Text
                "   <tr>" +
                "       <td>" + ResourceBLL.GetText(WebPartId, "SG_Body", "Nội dung") + "</td>" +
                "       <td><textarea id='txtBody' class='cssTextBoxDialog' style='width: 95%; height: 200px'>" + FSGCls.Content + "</textarea></td>" +
                "   </tr>" +
                // Control
                "   <tr>" +
                "       <td colspan='2'>" +
                "           <input type='button' id='btnDelete' value='" + ResourceBLL.GetText(WebPartId, "SG_Delete", "Xóa") + "' onclick=\"javascript:ClientDeleteFeedBackFromDetail('" + FSGCls.SuggestID + "');\" >&nbsp;" +
                "           <input type='button' id='btnClose' value='" + ResourceBLL.GetText(WebPartId, "SG_Close", "Đóng") + "' onclick='javascript:window.close();'>&nbsp;" +
                "       </td>" +
                "   </tr>" +
                "</table>" +
                "" +
                "";


            ReturnHtml = Environments.GetFormDialog(ReturnHtml, Title);
            return ReturnHtml;
        }


        public override bool AllowFrontService
        {
            get
            {
                return false;
            }
        }
    }
}
